package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import pojo.Manager;

public class LoginDao {
	public LoginDao(){
		
	}
	public List<Manager>  selectLogin(String id,String pw){
		ConnectDao connectDao = new ConnectDao();
		List<Manager> list = new ArrayList<Manager> ();
		String sql = "SELECT * FROM manager WHERE num = '"+id+"' AND pw = '"+pw+"'";
		try{
			ResultSet rs = connectDao.stat.executeQuery(sql);
			while(rs.next()){
				Manager manager = new Manager();
				manager.name = rs.getString("name");
				manager.num = rs.getString("num");
				manager.pw = rs.getString("pw");
				list.add(manager);
				
			}
		}catch(SQLException e){
			e.printStackTrace();
			connectDao.closeConnect();
			return null;
		}
		connectDao.closeConnect();
		return list;
	}
	
}
